<template>
  <div style="height: 6vh;background-color:#fff;padding: 10px 20px;">
    <span style="font-size: 20px;line-height: 60px;">车辆年检</span>
    <el-button type="primary" style="color: #fff;float: right;margin-top: 13px;">录入年检车辆</el-button>
  </div>
  <!-- 查询年检单卡片 -->
  <el-card style="margin: 20px;">
    <el-form inline="true">
      <el-form-item label="车牌号">
        <el-input placeholder="输入车牌号搜索"></el-input>
      </el-form-item>
      <el-form-item label="送检人员">
        <el-input placeholder="按送检人员搜索"></el-input>
      </el-form-item>
      <el-form-item label="年检状态">
        <el-select placeholder="选择年检状态" style="width: 200px;">
          <el-option label="送检中" value="1"></el-option>
          <el-option label="已完成" value="0"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button>重置</el-button>
        <el-button type="primary">查询</el-button>
      </el-form-item>
    </el-form>
  </el-card>
  <!-- 年检单数据表格卡片 -->
  <el-card>
    <el-table>
      <el-table-column type="index" label="编号" width="80px" align="center"></el-table-column>
      <el-table-column label="年检车辆" prop="" align="center"></el-table-column>
      <el-table-column label="年检项目" prop="" align="center"></el-table-column>
      <el-table-column label="送检人员" prop="" align="center"></el-table-column>
      <el-table-column label="年检地点" prop="" align="center"></el-table-column>
      <el-table-column label="年检时间" prop="" align="center"></el-table-column>
      <el-table-column label="有效期" prop="" align="center"></el-table-column>
      <el-table-column label="年检费用" prop="" align="center"></el-table-column>
      <el-table-column label="年检状态" prop="" align="center"></el-table-column>
      <el-table-column label="操作"align="center">
        <template>
          <el-button link type="primary">编辑</el-button>
          <el-button link type="warning">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </el-card>
  <!-- 年检单编辑弹窗 -->
  <el-dialog :title="dialogTitle" v-model="dialogVisible">
    <el-form label-position="top">
      <el-row :gutter="20">
        <el-col :span="12">
          <el-form-item label="送检人">
            <el-input></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="年检车辆">
            <el-select placeholder="请选择车牌号">
              <el-option v-for="v in vehicleArr" :label="v.license" :value="v.id"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="12">
          <el-form-item label="年检项目">
            <el-select placeholder="请选择项目">
              <el-option></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="年检地点">
            <el-select placeholder="请选择地点">
              <el-option></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="12">
          <el-form-item label="年检费用">
            <el-input placeholder="输入金额"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="年检证书">
            <el-input placeholder="输入证书编号：no.xxxx"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="12">
          <el-form-item label="送检时间">
            <el-date-picker></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="有效期">
            <el-date-picker></el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="12">
          <el-form-item label="年检状态">
            <el-radio-group>
              <el-radio label="年检中" value="1" border style="margin-right: 0;"></el-radio>
              <el-radio label="已完成" value="0" border></el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <template #footer>
      <el-button>取消</el-button>
      <el-button type="primary">保存</el-button>
    </template>
  </el-dialog>
</template>

<script setup>
import {onMounted, ref} from "vue";
import axios from "axios";
import {ElMessage} from "element-plus";

const dialogTitle = ref('新增年检单');
const dialogVisible = ref(true);
const user = ref(getUser());
const vehicleArr = ref([]);
onMounted(()=>{
  axios.get(BASE_URL+'/v1/vehicle/select')
      .then((response)=>{
        if(response.data.code == 2000){
          vehicleArr.value = response.data.data;
        }else {
          ElMessage.error(response.data.msg);
        }
      })
})
</script>

<style scoped>

</style>